import request from "@/axios"

export function getMaterialList(page,shopId,goodsName) {
    let url = '/api/material/list'
    let limit = 3
    let params = {page,limit,shopId,goodsName}
    return request.get(url,{params})
}

export function getShopList() {
    let url = 'api/material/findShop'
    return request.get(url)
}

export function getGoodsList(id) {
    let url = 'api/material/findByUserId/'+id
    return request.get(url)
}

export function setMaterial(shopId,goodsId,goodsName,content,img) {
    let url = '/api/material/save'
    let data = {
        shopId,
        goodsId,
        goodsName,
        content,
        img,
        Loading: true
    }
    data.json = true
    return request.post(url,data)
}

export function getMyMaterial(page,goodsName) {
    let url = '/api/material/findMaterial'
    let limit = 3
    let params = {page,limit,goodsName}
    return request.get(url,{params})
}

export function edit(item) {
    let url = '/api/material/update'
    let data = {
        ...item,
        Loading: true
    }
    data.json = true
    return request.post(url,data)
}